import {DiamondNodeModel, DiamondNode} from '@logicflow/core';

class CustomNodeModel extends DiamondNodeModel {
    setAttributes() {
        this.stroke = '#1E90FF';
        this.fill = '#F0F8FF';
        this.radius = 10;
        const {properties: {isDisabledNode}} = this;
        if (!isDisabledNode) {
// 单独为非禁用的元素设置菜单。
            this.menu = [
                {
                    text: 'del',
                    callback: (node: any) => {

                        this.graphModel.deleteNode(node.id);
                        this.graphModel.eventCenter.emit('custom:event', node);
                    },
                }
            ];
        }
    }
}

export default {
    type: "CustomNode",
    view: DiamondNode,
    model: CustomNodeModel,
}